<template>
  <div class="wrap">
    <div class="base_card" @click="_click">
      <div class="base_card_content">
        <div v-if="title" class="base_card_title">
          <div class="ellipsis">
            <span class="title">{{ title }}</span>
            <span>{{ number }}</span>
          </div>
          <van-icon v-if="arrow" class="into" name="arrow" @click="into" />
        </div>
      </div>
      <slot />
    </div>
    <slot name="footer"></slot>
  </div>
</template>

<script>
export default {
  name: 'baseCard',
  props: {
    title: {
      type: String,
      default: ''
    },
    number: {
      type: String,
      default: ''
    },
    // 展示右箭头
    arrow: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      list: [],
      isCollapse: true
    }
  },
  created() {},
  mounted() {},
  methods: {
    into() {
      this.$emit('into')
    },
    _click() {
      this.$emit('click')
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/assets/style/mixin.scss';

.wrap {
  border-radius: 6px;
  overflow: hidden;
  .base_card {
    width: 345px;
    background: #fff;
    box-shadow: 0px 2px 8px 0px rgba(178, 184, 189, 0.1);
    padding: 15px;
    position: relative;

    &_row {
      margin-bottom: 10px;
      display: flex;

      &:last-of-type {
        margin-bottom: 0;
      }
    }

    &_title {
      font-family: PingFang SC Medium;
      font-size: 16px;
      font-weight: normal;
      line-height: 22px;
      letter-spacing: 0px;
      color: #171819;
      margin-bottom: 15px;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .ellipsis {
        display: inline-block;
        text-overflow: ellipsis;
        overflow: hidden;
        word-break: break-all;
        white-space: nowrap;
      }

      .title {
        margin-right: 10px;
      }

      .into {
        font-size: 12px;
        color: #b2b8bd;
      }

      .danger {
        font-family: PingFangSCMedium-Medium;
        font-size: 12px;
        /* 错误色/错误色 */
        color: #ea0000;
        display: inline-block;
        width: 86px;
        height: 18px;
        text-align: center;
        line-height: 18px;
        /* 错误色/错误色 */
        border: 0.5px solid #ea0000;
        border-radius: 2px;
      }
    }
  }
}
</style>
